Computing devices can display information to human users in the form of text. Text is made up of strings of characters. For English text, the characters are in the form of letters and punctuation marks. Information presented in other languages may use other characters. Regardless of how the specific characters are used to represent text, a computing device may be configured with a utility that can receive input defining the text to be rendered on a display of the computer and then generate the appropriate control signals to the display so that the text is appropriately displayed.
Input defining the text to be rendered on a display can be in any suitable form, including using definitions of glyphs. A glyph is an element of text, such as all or a portion of a character. Where characters are letters and punctuation marks, a glyph may be all or a portion of a letter or punctuation mark like lines and dots. Definitions of glyphs describe the shape of the glyph, and can be in any suitable format and used in any suitable way to generate appropriate control signals to the display.
A rendering process to generate controls signals for appropriate display of text may include multiple steps. Some of these steps may be directed to making text more pleasing for human users to view. When viewing content on a computer display, humans tend to be more sensitive to how text is presented than they are to the presentation of other graphical objects. Presenting text via a computer display in a way that humans will find comfortable to view therefore requires steps different from those used for presenting images. One example of such extra steps is the handling of edges of glyphs of text.
In particular, many computer users do not like viewing or find it difficult to view text on a display when pixel values of the display are set to give glyphs hard, high-contrast edges because this can give the edges of text a blocky and jagged (or “aliased”) appearance. To provide a more pleasing presentation, “anti-aliasing” techniques are used. Anti-aliasing techniques select which pixels of the display are used to represent the glyph and the areas around the glyph and set an intensity for each such pixel to smooth edges of the glyphs and make the glyphs more pleasing to view.
When text is to be displayed on a display, the text may be displayed together with other display elements. For example, text may be displayed overlapping with background or foreground graphics. To display the text and a graphic as overlapping, a computing device determines a composite color to be emitted by individual pixels of the display that will create an effect of the text overlapping the graphic. To determine the composite color, calculations are performed using color information for the text and color information for the graphic. The color information for the text and the graphic may be contained in color values for each of the text and the graphic that correspond to pixels of the display. For example, where the color information for the text indicates a particular pixel should be red, and the color information for the graphic indicates the particular pixel should be blue, an overlapping effect may be created by identifying the composite color value for the pixel as purple.
To facilitate combining the color information, each color value for the text and overlapping display elements may be associated with “coverage” information, represented by coverage values (also called “alpha” values). When calculating a composite color value by combining color values for overlapping display elements, the coverage values for each display element are used to weight, on a pixel by pixel basis, the respective contributions of color values toward the composite color values. In particular, the coverage values can be used to introduce a transparency effect by weighting color values for one display element less than color values for another display element. For example, for an individual pixel, when the weighting from the coverage values makes a composite color value more similar to the color of a graphic, text that is to be displayed as being on top of the underlying graphic may appear on the display to be transparent or more transparent than if the composite color value was instead more similar to the text color.
Coverage values may also be used in anti-aliasing techniques for softening the edges of text and make the edges appear to blend smoothly with overlapping display elements. To make the edges appear to blend smoothly, when determining a composite color value for a pixel, a coverage value for the text for that pixel may be set to create a transparency effect. For example, coverage values for text can be set to create a more opaque effect for pixels in the middle of a glyph or close to the edge of a glyph and more transparent effect away from the edge of the glyph, which can create the blending effect. In particular, coverage values for text may be set per pixel of the display based on a proportion of the pixel that falls within a display area of any character of the text. For a pixel that falls completely within the area of a character, the coverage value may be specified to be 100%, such that the text is not transparent at that pixel (i.e., the color of the pixel will be more similar to the text color). Likewise, for a pixel that is entirely outside the area of any character of the text, the coverage value may be specified to be 0%, such that the text is fully transparent at that pixel and the pixel will not display any information related to the text. Pixels along edges of the text, which could be partially within and partially outside the area of characters of the text, would have a coverage value for the text between 0% and 100% based on the amount of any character that overlaps the pixel. Therefore, the contribution of the text color to the composite color value for the pixel will be weighted according to the proportion of the pixel that falls within the display area of a character of the text. This allows the text to be displayed with a smoothing effect that makes the text appear to blend into the background along the edges, rather than having a hard, high-contrast edge with the background. Coverage values set in this way can be normalized to be numbers between 0 and 1.
Multiple anti-aliasing techniques are known. One anti-aliasing technique for shading the edges of glyphs is often referred to as “grayscale” shading. Using grayscale shading, a single coverage value for the text is set for a pixel as a whole using the techniques previously described.
Another technique is known as sub-pixel anti-aliasing, or alternatively as sub-pixel coverage. This approach takes advantage of a characteristic of many computer displays that can present information in color. The pixels of many types of displays each include multiple sub-pixels that operate together to project light from the pixel. Each sub-pixel of a pixel emits light of a different color, such as red, green, or blue. By controlling the sub-pixels, both the intensity and color of light emitted from the pixel can be controlled.
In sub-pixel anti-aliasing techniques, instead of controlling the sub-pixels strictly based on the desired color and intensity of light to be emitted by an entire pixel, values to control each sub-pixel individually are set to create a smoothing effect when displaying a glyph. In particular, for sub-pixel anti-aliasing, coverage values are set separately for each sub-pixel of a pixel, rather than for an entire pixel as in grayscale anti-aliasing. While in grayscale anti-aliasing the coverage value for text for a pixel was set in proportion to the amount of the pixel that falls within a display area of a character, in sub-pixel anti-aliasing the coverage value may be set in proportion to the amount of each sub-pixel. The coverage values for individual sub-pixels can be used when setting composite control values for controlling each of the sub-pixels to emit light with certain intensity. In particular, as discussed above, the color information for the text can be combined with the sub-pixel coverage values for the text and color information for overlapping display elements to determine the composite control values for sub-pixels. As the sub-pixels of a display have a finer resolution than the full pixels, setting a coverage value for each sub-pixel, a finer grain of smoothing can be achieved than is possible using grayscale anti-aliasing and the visual appearance of text may be superior to that which can be achieved using grayscale anti-aliasing. MICROSOFT® CLEARTYPE® text, available from the Microsoft Corporation of Redmond, Wash., is an example of a smoothing technique that uses sub-pixel anti-aliasing.
As discussed above, coverage values can be used to create such transparency and smoothing effects because of the impact coverage values have on calculations to determine composite color values to be presented by a pixel of a display. These calculations on color values are performed when multiple display elements (such as text and a graphic) are to be displayed so as to appear overlapping, when the coverage values for the text are used to modify color values for the text. Though, a complexity arises when combining color information for multiple display elements. Because most displays do not respond linearly, mere linear interpolation of modified color values (as modified by coverage values) for multiple display elements will yield composite colors that do not appear to the human eye to be the superposition of the text and the graphic. Consequently, if modified color values for text and a graphic were combined by linear interpolation, the resulting display would not appear to a human to be correct. To avoid this result, it is known to apply a technique called “gamma correction” to alter the combination of the modified color values such that the composite color appears to a human viewer like the intended superposition. In gamma correction, the composite color values produced through linear interpolation are modified by a “gamma value” that is associated with the display that is to be used, such that the composite color values will appear correct.